﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Tecnicas.CasoEstudio.Back;
using System.IO;
using System.Runtime.Serialization.Formatters.Binary;
using Tecnicas.CasoEstudio.Repositorio;
using Tecnicas.CasoEstudio.Back.Persistencia;

namespace Tecnicas.CasoEstudio.Back.Dominio
{
    [Serializable]
    public class Persona : DomainObject
    {
        public Persona() 
        {         
        }
        private string nombre;
        public string Nombre
        {
            get { return this.nombre; }
            set { this.nombre = value; }
        }

        private long? persistenceIdMail = null;
        public long? PersistenceIdMail
        {
            get { return this.persistenceIdMail; }
            set { this.persistenceIdMail = value; }
        }

        private Mail mail;
        public Mail Mail
        {
            get {
                if (this.mail == null && this.PersistenceIdMail != null)
                {
                    this.mail = (Mail)new MailDataMapper().Find(typeof(Mail), this.PersistenceIdMail);
                }
                
                return this.mail;
            }
            set { this.mail = value;}
        }    
    }
}
